package com.yin.myproject.core;

import java.util.List;

/**
 * @author Eason
 * @create 2018-04-08 10:58
 **/
public interface IScheduleDataManager {
    /**
     * 发送心跳信息
     *
     * @param server
     * @throws Exception
     */
    boolean refreshScheduleServer(ScheduleServer server) throws Exception;

    /**
     * 注册服务器
     *
     * @param server
     * @throws Exception
     */
    void registerScheduleServer(ScheduleServer server) throws Exception;

    boolean isLeader(String uuid, List<String> serverList);

    void unRegisterScheduleServer(ScheduleServer server) throws Exception;

    void clearExpireScheduleServer() throws Exception;

    List<String> loadScheduleServerNames() throws Exception;

    void assignTask(String currentUuid, List<String> taskServerList) throws Exception;

    boolean isOwner(String name, String uuid) throws Exception;

    void addTask(ScheduleTask scheduleTask) throws Exception;

    void createAndUpdateTask(ScheduleTask scheduleTask) throws Exception;

    void delTask(ScheduleTask scheduleTask) throws Exception;

    List<ScheduleTask> selectTask() throws Exception;

    boolean checkLocalTask(String currentUuid) throws Exception;

    boolean isExistsTask(ScheduleTask scheduleTask) throws Exception;

    boolean saveRunningInfo(String name, String uuid) throws Exception;
}
